﻿using HelperUnity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace CDDY_VehicleRepo
{
    public static class Common
    {
        /// <summary>
        /// 得到动态配置文件.
        /// </summary>
        /// <returns></returns>
        public static string[] GetAppConfig()
        {
            string[] strAry = new string[6];
            try
            {
                string strPath = GetDllPath() + "//LocalConfig.ini";
                IniFileOperation intFile = new IniFileOperation(strPath);

                strAry[0] = intFile.IniReadValue("Setup", "DBPath");
            }
            catch (Exception ex)
            {

            }

            return strAry;
        }

        /// <summary>
        /// 得到当前动态库的路径.
        /// </summary>
        /// <returns></returns>
        public static string GetDllPath()
        {
            string str = Assembly.GetExecutingAssembly().CodeBase;
            int start = 8;// 去除file:///
            int end = str.LastIndexOf('/');// 去除文件名xxx.dll及文件名前的/
            str = str.Substring(start, end - start);
            return str;
        }
    }
}
